package cn.com.qtgl.apis.notification.comp.proxy;

import cn.com.qtgl.apis.notification.comp.NotificationConfig;
import cn.com.qtgl.apis.notification.model.input.ApplicationInput;
import cn.com.qtgl.apis.notification.model.input.ChannelInput;
import cn.com.qtgl.apis.notification.model.input.NotificationInput;
import cn.com.qtgl.apis.notification.model.view.*;
import cn.melonlib.apis.support.annos.ApiModule;
import cn.melonlib.apis.support.annos.ApiParameter;
import cn.melonlib.apis.support.annos.ApiRequest;
import cn.melonlib.apis.support.enums.ApiRequestActionType;
import cn.melonlib.objects.maps.JsonMap;

import java.util.List;

/**
 * 推送接口
 */
@ApiModule(
        value = "notification"
        ,apiModuleConfig = NotificationConfig.NOTIFICATION
)
public interface NotificationProxy {

    /**
     * 获得推送渠道
     * @return
     */
    @ApiRequest
    ChannelApiBody channels();
    @ApiRequest
    ChannelApiBody channels(
            @ApiParameter(name = "keyword",required = false,type = "String") String keyword,
            @ApiParameter(name = "enable",required = false,type = "Boolean") Boolean enable,
            @ApiParameter(name = "first",type = "Int") Integer first,
            @ApiParameter(name = "offset",type = "Int") Integer offset);

    @ApiRequest
    ChannelApiBody channels(
            @ApiParameter(name = "keyword",required = false,type = "String") String keyword,
            @ApiParameter(name = "enable",required = false,type = "Boolean") Boolean enable);

    @ApiRequest
    NotificationChannelView channel(@ApiParameter(name = "id",type = "ID") String id);

    /**
     * 获得推送应用
     * @param id
     * @return
     */
    @ApiRequest
    Application application(@ApiParameter(name = "id",type = "ID") String id);

    @ApiRequest
    List<Application> oauthApplications();

    /**
     * 获取已经推送的消息
     * @return
     */
    @ApiRequest
    NotificationApiBody notifications();

    @ApiRequest
    NotificationApiBody notifications(
        @ApiParameter(name = "ids",type = "[ID!]") List<String> ids,
        @ApiParameter(name = "status",type = "String") String status,
        @ApiParameter(name = "state",type = "Int")Integer state,
        @ApiParameter(name = "channel",type = "String")String channel,
        @ApiParameter(name = "application",type = "String")String application,
        @ApiParameter(name = "name",type = "String")String name,
        @ApiParameter(name = "startTime",type = "Date")Long startTime,
        @ApiParameter(name = "endTime",type = "Date")Long endTime,
        @ApiParameter(name = "tags",type = "String")String tags,
        @ApiParameter(name = "first",type = "Int")Integer first,
        @ApiParameter(name = "offset",type = "Int") Integer offset,
        @ApiParameter(name = "filter",type = "Map")JsonMap<JsonMap<Object>> filter
    );

    @ApiRequest
    NotificationApiBody notifications(
        @ApiParameter(name = "first",type = "Int")Integer first,
        @ApiParameter(name = "offset",type = "Int") Integer offset,
        @ApiParameter(name = "filter",type = "Map")JsonMap<JsonMap<Object>> filter
    );
    @ApiRequest
    NotificationApiBody notifications(
        @ApiParameter(name = "first",type = "Int")Integer first,
        @ApiParameter(name = "offset",type = "Int") Integer offset,
        @ApiParameter(name = "tags",type = "String")String tags
    );

    @ApiRequest
    NotificationApiBody notifications(
        @ApiParameter(name = "ids",type = "[ID!]") List<String> ids,
        @ApiParameter(name = "first",type = "Int")Integer first,
        @ApiParameter(name = "offset",type = "Int") Integer offset
    );

    @ApiRequest
    NotificationApiBody notifications(
        @ApiParameter(name = "ids",type = "[ID!]") List<String> ids
    );

    @ApiRequest
    NotificationApiBody notificationsAdmin();

    @ApiRequest
    NotificationApiBody notificationsAdmin(
        @ApiParameter(name = "ids",type = "[ID!]") List<String> ids,
        @ApiParameter(name = "status",type = "String") String status,
        @ApiParameter(name = "state",type = "Int")Integer state,
        @ApiParameter(name = "channel",type = "String")String channel,
        @ApiParameter(name = "application",type = "String")String application,
        @ApiParameter(name = "name",type = "String")String name,
        @ApiParameter(name = "startTime",type = "Date")Long startTime,
        @ApiParameter(name = "endTime",type = "Date")Long endTime,
        @ApiParameter(name = "tags",type = "String")String tags,
        @ApiParameter(name = "first",type = "Int")Integer first,
        @ApiParameter(name = "offset",type = "Int") Integer offset,
        @ApiParameter(name = "filter",type = "Map")JsonMap<JsonMap<Object>> filter
    );

    @ApiRequest
    NotificationApiBody notificationsAdmin(
        @ApiParameter(name = "first",type = "Int")Integer first,
        @ApiParameter(name = "offset",type = "Int") Integer offset,
        @ApiParameter(name = "filter",type = "Map")JsonMap<JsonMap<Object>> filter
    );

    @ApiRequest
    NotificationApiBody notificationsAdmin(
        @ApiParameter(name = "ids",type = "[ID!]") List<String> ids,
        @ApiParameter(name = "first",type = "Int")Integer first,
        @ApiParameter(name = "offset",type = "Int") Integer offset
    );

    @ApiRequest
    NotificationApiBody notificationsAdmin(
        @ApiParameter(name = "ids",type = "[ID!]") List<String> ids
    );

    @ApiRequest(apiRequestAction = ApiRequestActionType.SAVE)
    Application addApplication(@ApiParameter(name = "app" ,type = "ApplicationInput",required = true) ApplicationInput app);
    @ApiRequest(apiRequestAction = ApiRequestActionType.SAVE)
    Application updateApplication(@ApiParameter(name = "app" ,type = "ApplicationInput",required = true) ApplicationInput app);

    @ApiRequest(apiRequestAction = ApiRequestActionType.SAVE)
    Application delApplication(@ApiParameter(name = "id",type = "ID",required = true) String id);

    @ApiRequest(apiRequestAction = ApiRequestActionType.SAVE)
    NotificationChannelView addChannel(@ApiParameter(name = "channel",type = "ChannelInput",required = false) ChannelInput channel);

    @ApiRequest(apiRequestAction = ApiRequestActionType.SAVE)

    NotificationChannelView updateChannel(@ApiParameter(name = "channel",type = "ChannelInput",required = false) ChannelInput channel);
    @ApiRequest(apiRequestAction = ApiRequestActionType.SAVE)
    NotificationChannelView delChannel(@ApiParameter(name = "id",type = "ID",required = false) String id);

    @ApiRequest(apiRequestAction = ApiRequestActionType.SAVE)
    NotificationView notification(@ApiParameter(name = "notification",type = "NotificationInput",required = false) NotificationInput notification);

    @ApiRequest(apiRequestAction = ApiRequestActionType.SAVE)
    List<NotificationView> updateNotificationStatus(
            @ApiParameter(name = "ids", type = "[String!]",required = true) List<String> ids ,
            @ApiParameter(name = "action",type = "String",required = true) String action
    );

    @ApiRequest(apiRequestAction = ApiRequestActionType.SAVE)
    List<NotificationView> updateNotificationStatusAdmin(
            @ApiParameter(name = "ids",type = "[String!]",required = true) List<String> ids ,
            @ApiParameter(name = "action",type = "[String!]",required = true) String action ,
            @ApiParameter(name = "ids",type = "[String!]",required = true) String account
    );
}
